<include file="Public:headersmall"/>

<script type="text/javascript">
    //重载验证码
	function fleshVerify(){
		var timenow = new Date().getTime();
		document.getElementById('verifyImg').src='__GROUP__/Public/verify/'+timenow;  
     }

    function ckyzm(){
	    var yzm=$("[name=yzm]").val();
		$.ajax({
		      type:"GET",
			  dataType:"html",
			  url:"__URL__/ck_yzm",
			  data:{yzm:yzm},
			  success:function(data){
			       if(data=='1'){
                      $("#t_yzm").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t2.gif'/>验证码错误！");
					  $("#reg").attr('disabled',true);
					  //fleshVerify();
				   }else{
				      $("#t_yzm").html("<font size='2'><img src='__APP__/statics/reg-t3.gif'/>ok！");
					  $("#reg").attr('disabled',false);
				   }
			   }
		})
    }
</script>
<script type="text/javascript">
$(function(){ 
    //检查邮箱
    $("[name=email]").blur(function(){
	   if(this.value==''||(this.value!='' && !/.+@.+\.[a-zA-z]{2,4}$/.test(this.value))){
                $('#t_email').html("<span style='font-size:12px;'><img src='__APP__/statics/reg-t1.gif'/>请输入正确的邮箱地址</span>"); 
				$("#reg").attr('disabled',true);
            }else{
                $.ajax({
						type:"POST",
						dataType:"html",
						url:"__URL__/ck_reg",
						data:{email:this.value},
						success:function(data){
										if(data=='1'){
										    $("#t_email").html("<span style='font-size:12px;'><img src='__APP__/statics/reg-t2.gif'/>此邮箱已经被注册！</span>");
											$("#reg").attr('disabled',true);
										}else{
											$("#t_email").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t3.gif'/>恭喜你，可以使用！</font>");
											$("#reg").attr('disabled',false);
										}
									}
				})
		       //ajax结束
        }//if结束
	 })

	 //提示用户名
	 $("[name=uname]").focus(function(){
	     var b1="<font size='2'><img src='__APP__/statics/reg-t1.gif'/>请输入4-10字符，字母或数字</font>";
		 $("#t_name").html(b1);
		 
	 })
     //检查用户名
	 $("[name=uname]").blur(function(){
	     if(this.value=='') {
		      $("#t_name").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t2.gif'/>不得为空!</font>");
			  $("#reg").attr('disabled',true);
		 }else if(this.value.length<4){
		      $("#t_name").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t2.gif'/>至少4个字符！</font>");
			  $("#reg").attr('disabled',true);
		}else if(this.value.length>20){
			  $("#t_name").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t2.gif'/>最多20个字符！</font>");
			  $("#reg").attr('disabled',true);
		}else{
		 $.ajax({
		     type:"POST",
			 dataType:"html",
			 url:"__URL__/ck_reg",
			 data:{uname:this.value},
			 success:function(data){
								if(data=='1'){
									$("#t_name").html("<span style='font-size:12px;'><img src='__APP__/statics/reg-t2.gif'/>此用户已经被注册！</span>");
									$("#reg").attr('disabled',true);
								}else if(data!='1'){
								    $("#t_name").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t3.gif'/>恭喜你，可以使用！</font>");
									$("#reg").attr('disabled',false);
								}
				           }
	     })
		 }
			     
	 })

	 //检查密码
	 $("[name=rpwd]").blur(function(){
	     var pwd=$("[name=pwd]").val();
		 var rpwd=$("[name=rpwd]").val();
		 if(pwd!=rpwd){
		   $("#t_pwd").html("<font size='2' color='#FF0000'><img src='__APP__/statics/reg-t2.gif'/>两次密码不一致！</font>");
		   $("#reg").attr('disabled',true);
		 }else if(pwd==''||rpwd==''){
		   $("#t_pwd").html("<font size='2'><img src='__APP__/statics/reg-t1.gif'/>请输入密码！</font>");
		   $("#reg").attr('disabled',true);
		 }else{
		   $("#t_pwd").html("<img src='__APP__/statics/reg-t3.gif'/>");
		   $("#reg").attr('disabled',false);
		}
	})

	$("#reg").click(function(){
	    var name=$("[name=uname]").val();
		var pwd=$("[name=pwd]").val();
		var rpwd=$("[name=rpwd]").val();
		var yzm=$("[name=yzm]").val();
		ckyzm();
		if(name==''||pwd==''||rpwd==''||yzm==''){
		     $("#reg").attr('disabled',true);
		}
	})

})
</script>
<style>
.reg input{padding:7px;width:200px}
body{font-size:13px}
.reg{width:810px;margin:0 auto;margin-top:50px;padding:20px;border: 1px solid #C0C0C0;}
</style>
<div class="reg">
<form method="POST" action="__URL__/insert">
<table align="center" border="0">
	<tr>
		<td align="left" colspan="3" height="45"><span style="font-size:20px;font-weight:bold">会员注册</span></td>
		<td align="left" height="45"><span style="font-size:20px;font-weight:bold">直接登录</span></td>
	</tr>
	<tr height="42px">
		<td align="right" width="20%">用户名：</td>
		<td align="left"><input type="text" name="uname" id="uname" size="20" ></td>
		<td align="left" id="t_name"></td>
		<td width="50%" rowspan="7" valign="top" align="center">
		    <div>{$regad.content}</div>
			<div style="margin-top:10px"><a href="__APP__/Member/qqlogin"><img src="__APP__/statics/qq_login.png"></a></div>
		</td>
	</tr>
	<tr height="42px">
		<td align="right" width="20%">请设置密码：</td>
		<td align="left" width="16%"><input type="password" name="pwd" size="20"></td>
		<td>　</td>
	</tr>
	<tr height="42px">
		<td align="right" width="20%">请确认密码：</td>
		<td align="left" width="16%"><input type="password" name="rpwd" size="20"></td>
		<td width="30%" id="t_pwd"></td>
	</tr>
	<tr height="42px">
		<td align="right" width="20%">电子邮箱：</td>
		<td align="left" width="16%"><input type="text" name="email" size="20"></td>
		<td width="30%" id="t_email">　</td>
	</tr>
	<tr height="42px">
		<td align="right" width="20%">验证码：</td>
		<td align="left" width="16%">
		<input type="text" name="yzm" size="10" onblur="ckyzm()" style="width:50px">
		<img  id="verifyImg" src="__GROUP__/Public/verify" onClick="fleshVerify()" BORDER="0" ALT="点击刷新验证码" style="cursor:pointer"/><a href="javascript:;" onClick="fleshVerify()">换一张</a>
		</td>
		<td width="30%" id="t_yzm">　</td>
	</tr>
	<tr height="42px">
		<td align="right" colspan="2" width="16%"><input type="checkbox" style="width:30px" checked>我已阅读并同意<a href="__APP__/Help/page/?type=tk&id=3" target="_blank"><font color="#317ee7">《蚂蚁街用户注册协议》</font></a></td>
		<td width="30%">　</td>
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="image" src="__APP__/statics/btn-register.gif" id="reg" style="border:0px;width:100px"></td>
		<td width="30%">　</td>
	</tr>
</table>
</form>
</div>

<include file="Public:footersmall"/>